<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="./css/aui.css" />
    <link rel="stylesheet" type="text/css" href="./css/font-awesome.css" />
    <link rel="stylesheet" type="text/css" href="./css/style.css" />
    <script type="text/javascript" src="./script/jquery.min.js"></script>
    <script type="text/javascript" src="./script/doT.min.js"></script>
    <script type="text/javascript" src="./script/base.js"></script>
    <script type="text/javascript" src="./script/api.js"></script>
    <style type="text/css">
        .header {
            padding: 2.5rem 0.5rem 2rem 0.5rem;
        }
    </style>
</head>

<body>
    <header class="aui-bar aui-bar-nav" style="padding-top:25px;">
        <a class="aui-pull-left aui-btn" onclick="closeWin()">
            <span class="aui-iconfont aui-icon-left"></span>
        </a>
        <div class="aui-title">可大金服OA</div>
        <a class="aui-pull-right aui-btn nav-btn">
        </a>
    </header>


    <div class="approval-details">
        <ul>
            <li>
                <p>申请人：</p>
                <span id='name'></span>
            </li>
            <li>
                <!-- <p>申请文章：</p>
            <span>文章标题文章标题文章标题文章标题</span> -->
            </li>
            <li>
                <p>申请时间：</p>
                <span id='create_time'></span>
            </li>
            <li>
                <p>申请原因：</p>
                <span id='content'></span>
            </li>
        </ul>
        <div class="approval-details-d">
            <span class="aui-btn aui-btn-danger" onclick="check(2)">驳回</span>
            <span class="aui-btn aui-btn-success" onclick="check(1)">通过</span>
        </div>
    </div>

    <!-- <div class="foot-t"></div>
<ul class="foot">
  <li>
    <i class="aui-iconfont aui-icon-home"></i>
    <p>首页</p>
  </li>
  <li>
    <i class="aui-iconfont aui-icon-my"></i>
    <p>我的</p>
  </li>
</ul>
</body> -->

    <script type="text/javascript" src="./script/api.js"></script>
    <script type="text/javascript">
        apiready = function() {
            get_data();
        }

        function get_data() {
            id = api.pageParam.id;
            userid = $api.getStorage('id');

            var url = 'http://oa.big-wealth.com/index.php?m=&c=info&a=info_apply_wz&api_auth_id=' + userid + '&apply_id=' + id;
            // console.log(url);

            api.ajax({
                url: url,
                method: 'get',
                data: {

                }
            }, function(ret, err) {
                if (ret) {
                    // console.log( JSON.stringify( ret ) );
                    // alert(JSON.stringify(ret));
                    $('#name').text(ret.info.user_name);
                    var time = getDate(ret.info.create_time);
                    $('#create_time').text(time);
                    $('#content').html(ret.info.content);
                } else {
                    alert(JSON.stringify(err));
                }
            });

        }

        function check(type) {

            api.ajax({
                url: 'http://oa.big-wealth.com/index.php?m=&c=info&a=info_auditsh&api_auth_id=' + userid + '&id=' + id + '&status=' + type,
                method: 'get',
                data: {
                    values: {
                        // api_auth_id: userid,
                        // id:id,
                        // status:type


                    },
                    files: {
                        // file: 'fs://a.gif'
                    }
                }
            }, function(ret, err) {
                if (ret) {
                    api.execScript({
                        name: 'approval',
                        script: 'getData(0)'
                    });
                    api.closeWin();
                } else {
                    alert(JSON.stringify(err));
                }
            });


        }






        function openClub() {
            var delay = 0;
            if (api.systemType != 'ios') {
                delay = 300;
            }
            api.openWin({
                name: 'club_win',
                url: './html/club_win.html',
                bounces: false,
                delay: delay,
                slidBackEnabled: true,
                vScrollBarEnabled: false,
                progress: {
                    type: "page"
                }
            });
        }
        $(".nav-btn").on("click", function() {
            $(".nav").slideToggle(100);
        })
        $(".nav .aui-list-item").on("click", function() {
            $(".nav").hide();
        })

        function closeWin() {
            api.closeWin({});
        }
    </script>

</html>
